﻿using System.Collections.ObjectModel;
using Samurai.Infrastructure;

namespace Samurai.Client.DataContexts
{
    public class DirectoriesDataContext : ADataContext
    {
        private static DirectoriesDataContext _instance;
        public static DirectoriesDataContext Instance
        {
            get
            {
                if (_instance == null)
                    _instance = new DirectoriesDataContext();
                return _instance;
            }
        }

        public ObservableCollection<CandidateMovie> Directories { get; set; }

        public OpenDirectoryCommand OpenDirectoryCommand { get; set; }

        public RefreshDirectoriesCommand RefreshDirectoriesCommand { get; set; }

        private DirectoriesDataContext()
        {
            Directories = new ObservableCollection<CandidateMovie>();         

            OpenDirectoryCommand = OpenDirectoryCommand.Instance;
            RefreshDirectoriesCommand = new RefreshDirectoriesCommand(Directories);
        }        

        public override void OnLoaded()
        {
            RefreshDirectoriesCommand.Execute(null);
        }
    }
}